<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>学生选课信息</title>

<link rel="stylesheet" type="text/css" href="css/common.css">
<link rel="stylesheet" href="dist/css/bootstrap.css">
<link rel="stylesheet" href="dist/css/font-awesome-4.4.0/font-awesome.min.css">
<link rel="stylesheet" href="css/AdminLTE.css">

</head>
<body>
	<div style="margin:1% 1% 0 1%;">
		<center>
			<font style="color: rgb(44, 102, 148); font-weight: bold;">
				<span id="userinfo"></span></font> 选课情况
			<hr style="color: rgb(44, 102, 148);margin:0;border-top:3px solid #eee;">
		</center>
		<table border=0 id="table">
			<!-- <tr align=center>
				<td>退课</td>
				<td><font size="color:#0000ff">课程号</font></td>
				<td>课程名称</td>
				<td>类别</td>
				<td>学分</td>
				<td>备注1</td>
				<td>备注2</td>
			</tr>
			<form name=cancel>
			<tr>
				<td><input type="checkbox" name="course_no" value="1001001000"></td>
				<td>1001001000</td>
				<td>岗位实践(1)</td>
				<td><font color="#cc0066">必修</font></td>
				<td align=center>2</td>
				<td align=center><font color="#006666">本阶段选课</font></td>
				<td align=center>--
			</tr>
			<tr>
				<td><input type="checkbox" name="course_no" value="1001001001"></td>
				<td>1001001001</td>
				<td>岗位实践(2)</td>
				<td><font color="#cc0066">必修</font></td>
				<td align=center>2</td>
				<td align=center><font color="#006666">本阶段选课</font></td>
				<td align=center>--
			</tr>
			<tr>
				<td><input type="checkbox" name="course_no" value="1001001002"></td>
				<td>1001001002</td>
				<td>岗位实践(3)</td>
				<td><font color="#cc0066">必修</font></td>
				<td align=center>2</td>
				<td align=center><font color="#006666">本阶段选课</font></td>
				<td align=center>--
			</tr> -->
		</table>

		<center>
			<font color="#0099cc">选课学分： <span id="xuanCredit"></span> 分,
			免听学分： <span id="mianCredit"></span> 分，
			总学分： <span id="totalCredit"></span> 分 
			</font>
			
			<font color="#ff00ff" face="楷体_gb2312">
			（你的限选学分：
			<span id="stuCredit"></span>
			分 </font>）
		</center>
	</div>
	
	
	<script src="dist/js/bootstrap.js"></script>
	<script src="dist/js/jquery-2.2.3.min.js"></script>
	<script src="dist/js/bootstrap.js"></script>
	<script src="dist/js/bootstrap-table.js"></script>
	<script src="dist/js/bootstrap-table-zh-CN.js"></script>
	
	<script type="text/javascript">
		var table;
	    var tbBody = "";
	    var temp = 0;
		
		$(document).ready(function() {
			if (temp == 0) {
				tbBody += "<tr align=center>"
					+"<th>退课</th>"
					+"<th><font size='color:#0000ff'>课程号</font></th>"
					+"<th>课程名称</th>"
					+"<th>类别</th>"
					+"<th>学分</th>"
					+"<th>备注1</th>"	
					+"<th>备注2</th>"									
					+"</tr>";
				$("#table").append(tbBody);
				temp = 1;
			}
			getStudentInfo();
			//getStudentCourses();
		});
				
		//界面开始加载过程中，直接从后台获取用户的信息
		function getStudentInfo() {
			$.ajax({
				url:'/ui/get-student-info',
				data:{
				},
				type:'POST',
				dataType:'json',
				success:function(data){											
					$("#userinfo").html(data.name+data.account);
					$("#stuCredit").html(data.stuCredit);
				},
				error:function() {
				} 
			});
		}
		
		function getStudentCourses() {					
			$.ajax({
				url:'/ui/get-courses-by-account',
				data:{
				},
				type:'POST',
				dataType:'json',
				success:function(data){
					var tableLength = data.length;
					var table = document.getElementById("table");
					//在这里打印出各个学院的名称
					for (var i=0;i<tableLength;i++){
						if(i==0){							
						} else {
							/* var examineTemp = data[i].examine, examineString="";
							var creditTypeTemp = data[i].creditType, creditTypeString="";
							
							if(examineTemp == "0")
								examineString = "期末考试为主型";
							else if(examineTemp == "1")
								examineString = "过程考核为主型";
							
							if(creditTypeTemp == "0")
								creditTypeString = "理科学分";
							else if(creditTypeTemp == "1")
								creditTypeString = "文科学分";
							else if(creditTypeTemp == "2")
								creditTypeString = "体育课";//保留
							else if(creditTypeTemp == "3")
								creditTypeString = "无";
							
							tbBody += "<tr>"
								+"<td><a href=''><input type='button' value='选' style='background-color:rgb(44,102,148);color:#fff;'></a></td>"
								+"<td><input type='button' value='选' style='background-color:rgb(44,102,148);color:#fff;'></td>"
								+"<td>"+data[i].account+"</td>"
								+"<td><a href='course-description?courseID="+data[i].id+"' target=_new>"+data[i].name+"</a></td>"
								+"<td>"+data[i].classIds+"</td>"
								+"<td>"+data[i].teacherName+"</td>"
								+"<td>"+data[i].credit+"</td>"
								+"<td>"+examineString+"</td>"
								+"<td><a href='course-number?courseID="+data[i].id+"' target=_new><i class='fa fa-user'></i></a></td>"
								+"<td>"+data[i].times+"</td>"
								+"<td>"+data[i].weeks+"</td>"
								+"<td>"+creditTypeString+"</td>"
								+"<td>"+data[i].remarks+"</td>"
								+"</tr>"; */
							$("#table").append(tbBody);
						}
					}
				},
				error:function() {
					alert("该学院课程数据加载失败,请点击重试!");
				} 
			});			
		}
	</script>
</body>
</html>